<template>
	<view>
		<mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
			<view class="bg-fff mx12 br10" v-for="(item, index) in pageList" :key="index" @tap="pushDetaile(item.id)">
				<view class="dis-flex flex-align-center bb mt10 px10 py10">
					<view class="flex c-333 fs14 fwb">合同编码：{{item.htnum}}</view>
				</view>
				<view class="py10 after-line px10">
					<th-message-view title="甲方" titleColor="#333" :size="28" :detail="item.partyA" paddingY="10" detailColor="#999">
					</th-message-view>
					<th-message-view title="乙方" titleColor="#333" :size="28" :detail="item.partyB" paddingY="10" detailColor="#999">
					</th-message-view>
					<th-message-view title="签约人群" titleColor="#333" :size="28" :detail="item.sign_type == 1?'个人':'企业'" paddingY="10" detailColor="#999">
					</th-message-view>
					<!-- <th-message-view title="待签约者手机号" titleWidth="230rpx" titleColor="#333" :size="28" :detail="item.mobile" paddingY="10" detailColor="#999">
					</th-message-view>
					<th-message-view title="创建时间" titleColor="#333" :size="28" :detail="$u.timeFormat(item.createtime, 'yyyy-mm-dd')" paddingY="10" detailColor="#999">
					</th-message-view> -->
				</view>
				<view class="px10 pb10 dis-flex flex-align-center" style="flex-direction: row-reverse;">
					<view class="bg-common c-fff br5 fs15 ml10 center lh35 fw500" style="width: 180rpx;" @click.stop="addTemplete(item.id)">申请链接</view>
					<view class="bg-common c-fff br5 fs15 ml10 center lh35 fw500" style="width: 180rpx;" v-if="item.file" @click.stop="fileLook(item.file)">查看合同</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
	import validate from "@/common/thformvalidate";
	export default {
		mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
		data() {
			return {
				pageList: [],
				id:'',
				addPopup:false,
				subData:{
					jiafang:'',
					yifang:'',
					mobile:'',
					sign_type:'1'
				},
				loginLoading:false,
			}
		},
		
		methods: {
			downCallback(){
				setTimeout(() => {
					this.mescroll.resetUpScroll();
				},1000);
			},
			
			upCallback(page) {
				this.$http.post(this.$config.UrlAddContractList,{
					page: page.num,
				},{log:true,header: {
						'content-type': 'application/json'
					}}).then((res) => {
					let datalist = res?.data?.data || []
					if (page.num == 1) this.pageList = [];
					this.pageList.push.apply(this.pageList, datalist);
					this.mescroll.endBySize(datalist.length, res?.data?.total);
				}).catch((err) => {
					this.mescroll.endErr();
				})
			},
			
			fileLook(src){
				this.$api.openWindow('/pages/center/fileLook?src='+src);
			},
			
			addTemplete(id){
				this.$api.openWindow('/pages/center/contractEdit?id='+id);
			},
			
			//刷新页面
			refreshList(){
                this.mescroll.resetUpScroll();
			}
		}
	}
</script>

<style scoped>
	.popView{width:650rpx;padding-bottom: 20rpx;}
	.btn-minis{border-radius: 40rpx;height: 50rpx;;line-height: 50rpx;font-size: 26rpx;min-width: 100rpx;}
</style>
